package com.call.net;

import java.util.ArrayList;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import com.call.Constants;

public class JSONUtils {
	public static JSONObject BuildBlackList(ArrayList<String> blackNumberList, 
			String selfPhoneNum) throws JSONException
	{
		JSONObject blackListJson = new JSONObject();
		JSONArray blackListJsonArray = new JSONArray();
		for(int i = 0; i < blackNumberList.size(); i ++ ) {
			blackListJsonArray.put(blackNumberList.get(i));
		}
		blackListJson.put(Constants.SELF_PHONENUMBER_KEY, selfPhoneNum);
		blackListJson.put(Constants.BLACK_NUMBERS_KEY, blackListJsonArray);
		return blackListJson;
	}
}
